<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // var reg = /\d{3}/;

        // var strs = 'abcdefg';
        // var res = reg.exec(strs);
        // var strs1 = 'abcdefg6adfd888ab';
        // var res1 = reg.exec(strs1);
        // console.log(res1[0])



        // var strs2 = 'abc123def456ghi789ssh007';
        // var res2 = reg.exec(strs2);
        // console.log(res2);
        // console.log(reg.exec(strs2))
        // console.log(reg.exec(strs2))

        var reg = /\d{3}/g;
        var strs2 = 'abc123def456ghi789ssh007';
        var res2 = reg.exec(strs2);
        console.log(res2); // 123   
        console.log(reg.exec(strs2))// 456
        console.log(reg.exec(strs2))//789
        console.log(reg.exec(strs2))//007
        console.log(reg.exec(strs2))// null


    </script>
</body>
</html>